package com.kaigejava.rulesengine.bussiness.service;


import com.kaigejava.rulesengine.engine.dto.CreRuleDto;
import com.kaigejava.rulesengine.engine.dto.RuleHitDto;
import com.kaigejava.rulesengine.engine.fact.RecyclingFact;

import java.util.List;
import java.util.Map;

/**
 * @author kaigejava
 */
public interface IEngineService {
    /**
     * 判断规则是否命中
     * @param data
     * @return
     */
    public RuleHitDto isHitRule(RecyclingFact data);

    /**
     * 动态添加规则
     * @param rule
     */
    public void bufferSaveRule(CreRuleDto rule);

    /**
     * 动态修改规则
     * @param rule
     */
    public void bufferUpdateRule(CreRuleDto rule);

    /**
     * 动态删除规则
     * @param ruleId
     */
    public void bufferDeleteRule(Integer ruleId);

    /**
     * 获取加载的规则
     * @return
     */
    public  String findDroiksRuleMap();

    /**
     * 查询所有规则
     * @param map
     * @return
     */
    public List<CreRuleDto> findCreRuleList(Map<String, Object> map);

    /**
     * 计算积分
     * @param pathId
     * @param actionId
     * @param value
     * @param hour
     * @return
     */
    Map<String,Object> calculatePoint(int pathId, int actionId, int value, int hour);

    /**
     * 删除任务规则缓存
     * @param pathId
     * @param actionId
     */
    public void deleteTaskRuleCache(int pathId, int actionId);

}